home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
TUTORIAL
/
1307B.ZIP
/
OPTYPE.MOD
< prev
next >
Wrap
Text File
|
1989-01-18
|
1KB
|
47 lines
(* Chapter 13 - Program 9 *)
MODULE OpType;
FROM InOut IMPORT WriteString, WriteCard, WriteLn;
FROM OpaqueType IMPORT BoxType, MakeBox, Volume, Area;
VAR Big, Little, Tiny : BoxType;
TempVal : CARDINAL;
BEGIN
Big := MakeBox(12,8,11); (* Create and initialize a box *)
Little := MakeBox(2,4,3); (* Create and initialize a box *)
Tiny := MakeBox(1,1,1); (* Create and initialize a box *)
WriteString("The big box has a volume of ");
TempVal := Volume(Big);
WriteCard(TempVal,4);
WriteString(" units.");
WriteLn;
WriteString("The little box has an area of ");
WriteCard(Area(Little),4);
WriteString(" units.");
WriteLn;
(* This is comparing the opaque values, in this case pointers *)
IF Little # Big THEN
WriteString("The little box and the big box are not equal.");
WriteLn;
END;
END OpType.
(* Result of execution
The big box has a volume of 1056 units.
The little box has an area of 52 units.
The little box and the big box are not equal.
*)